/***************************************************************************
 *   Copyright (C) 2007 by Marcin Swiechowicz   *
 *   marcin.swiechowicz@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#include "kdcjob.h"

#include <KLocale>

KDCJob::KDCJob( QObject *parent )	: KJob( parent )
{

}

KDCJob::~KDCJob()
{

}

int KDCJob::count() const
{
	if ( totalAmount( KJob::Bytes ) > 0 ) 
		return 1;
	else
		return 0;
}

void KDCJob::setFlag( int id, bool flag )
{
	p_flags.insert( id, flag );
}

bool KDCJob::flag( int id )
{
	return p_flags.value( id );
}

void KDCJob::resetFlags()
{
	QMap<int,bool>::iterator it;
	for ( it = p_flags.begin(); it != p_flags.end(); ++it )
		it.value() = FALSE;
}

QString KDCJob::startupMessage() const
{
	return p_startMessage;
}

QString KDCJob::endingMessage() const
{
	return p_endMessage;
}

void KDCJob::setStartupMessage( const QString& info )
{
	p_startMessage = info;
}

void KDCJob::setEndingMessage( const QString& info )
{
	p_endMessage = info;
}

void KDCJob::setStandardErrorMessage( int code )
{
	setError( code );
	setErrorText( i18n("There was an error during process.") );
}

void KDCJob::resetErrors()
{
	setError( 0 );
	setErrorText( "" );
}

void KDCJob::setTotalSize( qulonglong size )
{
	setTotalAmount( KJob::Bytes, size );
}
